package trackexplorer.editors;

import java.io.File;

import org.eclipse.jface.resource.ImageDescriptor;
import org.eclipse.ui.IEditorInput;
import org.eclipse.ui.IPersistableElement;

public class MapInput implements IEditorInput{
    private File file;

    public File getFile(){
        return file;
    }

    public MapInput(File file){
        this.file = file;
    }

    public boolean exists(){
        return file.exists();
    }

    public ImageDescriptor getImageDescriptor(){
        return null;
    }

    public String getName(){
        return file.getName();
    }

    public IPersistableElement getPersistable(){
        return null;
    }

    public String getToolTipText(){
        return file.getAbsolutePath();
    }

    @SuppressWarnings("unchecked")
    public Object getAdapter(Class adapter){
        return null;
    }

    @Override
    public boolean equals(Object obj){
        if(super.equals(obj)){
            return true;
        }
        if(!(obj instanceof MapInput)){
            return false;
        }
        MapInput other = (MapInput)obj;
        return getFile().getAbsolutePath().equals(
            other.getFile().getAbsolutePath());
    }

    @Override
    public int hashCode(){
        return file.getAbsolutePath().hashCode();
    }
}
